import { DailyListNormal } from "./DailyListNormal";
import { Language } from "../../../../../extend/language/Language";
import { ObjCreate } from "../../common/ObjCreate";
import { GBoxDirection } from "../../../../../com/mui/containers/globalVariable/GBoxDirection";
import { MuiEvent } from "../../../../../com/mui/events/MuiEvent";
import { ClockManager } from "../../../manager/ClockManager";
import { Cache } from "../../../cache/Cache";
import { DailyInfo } from "../../../model/DailyInfo";
import { GTabBar } from "../../../../../com/mui/controls/GTabBar";
type int = number;
//class DailyEveryDayActiveList
    
    export  class DailyEveryDayActiveList extends DailyListNormal
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ initUI(): void
        {
            super.initUI();
            var loc1=Language.getArray(90325);
            this._tabBar = ObjCreate.createGTabBar(675, 10, loc1, 23, 125, this, this.onTabBarChangeHandler, "TabButtonVecRight");
            this._tabBar.direction = GBoxDirection.VERTICAL;
            this._tabBar.verticalGap = 5;
            this._tabBar.resetPosition2();
            this.onTabBarChangeHandler();
            return;
        }

        /* internal  */onTabBarChangeHandler(arg1: MuiEvent=null): void
        {
            var loc1=this._tabBar.selectedIndex;
            var loc2=ClockManager.instance.nowDate;
            var loc3=loc2.time / (1000 * 60 * 60 * 24) / 7;
            this._curWeekType = loc3 % 2 != 1 ? 2 : 1;
            if (loc1 != 0) 
            {
                this._selectWeekType = this._curWeekType != 1 ? 1 : 2;
                this._isCurWeek = false;
            }
            else 
            {
                this._selectWeekType = this._curWeekType;
                this._isCurWeek = true;
            }
            if (arg1 != null) 
            {
                this.updateDataByWeekType(this._type, this._selectedType);
            }
            return;
        }

        public updateDataByWeekType(arg1: int, arg2: int=0): void
        {
            var loc3=null;
            this._type = arg1;
            this._selectedType = arg2;
            var loc1=Cache.instance.daily.getListByType(arg1);
            var loc2=[];
            var loc4=loc1.length;
            var loc5=0;
            while (loc5 < loc4) 
            {
                loc3 = loc1[loc5] as DailyInfo;
                if (this._isCurWeek) 
                {
                    loc3.isCurWeekInfo = true;
                }
                else 
                {
                    loc3.isCurWeekInfo = false;
                }
                if (loc3.weekType == 0 || loc3.weekType == this._selectWeekType) 
                {
                    loc2.push(loc3);
                }
                ++loc5;
            }
            updateData(loc2, arg1, arg2);
            return;
        }

        /* internal */ /* var */_tabBar: GTabBar;

        /* internal */ /* var */_curWeekType: int;

        /* internal */ /* var */_type: int;

        /* internal */ /* var */_selectedType: int;

        /* internal */ /* var */_selectWeekType: int;

        /* internal */ /* var */_isCurWeek: Boolean;
    }
